import { IPSCtrlMsgItem } from './ipsctrl-msg-item';
import { IPSLanguageRes } from './ipslanguage-res';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSCtrlMsgItemImpl extends PSModelObjectImpl implements IPSCtrlMsgItem {
  get codeName(): string {
    return this.M.codeName;
  }

  get content(): string {
    return this.M.content;
  }

  protected contentpslanguageres: IPSLanguageRes | null = null;

  getContentPSLanguageRes(): IPSLanguageRes | null {
    if (this.contentpslanguageres != null) return this.contentpslanguageres;
    const value = this.M.getContentPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.contentpslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getContentPSLanguageRes') as IPSLanguageRes;
    return this.contentpslanguageres;
  }

  get contentPSLanguageRes(): IPSLanguageRes | null {
    return this.getContentPSLanguageRes();
  }

  getContentPSLanguageResMust(): IPSLanguageRes {
    const value = this.getContentPSLanguageRes();
    if (value == null) {
      throw new Error('未指定内容语言资源');
    }
    return value;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  get timeout(): number {
    return this.M.timeout != null ? this.M.timeout : -1;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSCtrlMsgItemImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'res.IPSCtrlMsgItem') return true;
    return super.instanceof(cls);
  }
}
